﻿using System.Collections.Generic;

namespace Xom.Generator.Templates
{
    public partial class FileTemplate
    {
        /// <summary>
        /// NameSpace of the Classes
        /// </summary>
        public string NameSpace { get; set; }

        /// <summary>
        /// List of all complex Types
        /// </summary>
        public IList<XsdComplexType> Types { get; set; }

        /// <summary>
        /// List of all enums
        /// </summary>
        public IList<XsdEnumerationType> Enums { get; set; }

        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="complexTypes"></param>
        /// <param name="enums"> </param>
        /// <param name="nameSpace"></param>
        public FileTemplate(IList<XsdComplexType> complexTypes, IList<XsdEnumerationType> enums, string nameSpace)
        {
            Types = complexTypes;
            Enums = enums;
            NameSpace = nameSpace;
        }

        public string GetItemInterface(XsdComplexType item)
        {
            InterfaceTemplate interfaceTemplate = new InterfaceTemplate(item);
            return interfaceTemplate.TransformText();
        }

        public string GetItemClass(XsdComplexType item)
        {
            ClassTemplate classTemplate = new ClassTemplate(item);
            return classTemplate.TransformText();
        }

        public string GetItemEnum(XsdEnumerationType item)
        {
            EnumerationTemplate enumTemplate = new EnumerationTemplate(item);
            return enumTemplate.TransformText();
        }
    }
}
